<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
	<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
	<meta name="apple-mobile-web-app-capable" content="yes"/>
	<title>Transition Listener (dojo.connect)</title>

	<script type="text/javascript" src="../deviceTheme.js" data-dojo-config="mblThemeFiles: ['base']"></script>
	<script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="async: true, parseOnLoad: true"></script>

	<script type="text/javascript">
		require([
			"dojo/_base/connect",
			"dojo/ready",
			"dijit/registry",
			"dojox/mobile/parser",
			"dojox/mobile",
			"dojox/mobile/compat"
		], function(connect, ready, registry){
			var print = function(name, view, moveTo, dir, transition, context, method){
				console.log(name +
							": view=" + view +
							", moveTo=" + moveTo +
							", dir=" + dir +
							", transition=" + transition +
							", context=" + context +
							", method=" + method +
							", movedFrom=" + view.movedFrom);
			};
			ready(function(){
				var view1 = registry.byId("view1");
				connect.connect(view1, "onStartView", null, function(){
					console.log("startView: view="+this);
				});
				connect.connect(view1, "onBeforeTransitionOut", null, function(moveTo, dir, transition, context, method){
					print("onBeforeTransitionOut", this, moveTo, dir, transition, context, method);
				});
				connect.connect(view1, "onBeforeTransitionIn", null, function(moveTo, dir, transition, context, method){
					print("onBeforeTransitionIn", this, moveTo, dir, transition, context, method);
				});
				connect.connect(view1, "onAfterTransitionOut", null, function(moveTo, dir, transition, context, method){
					print("afterTransitionOut", this, moveTo, dir, transition, context, method);
				});
				connect.connect(view1, "onAfterTransitionIn", null, function(moveTo, dir, transition, context, method){
					print("afterTransitionIn", this, moveTo, dir, transition, context, method);
				});
			});
		});
	</script>
</head>
<body style="visibility:hidden;">
	<div id="view1" data-dojo-type="dojox.mobile.View">
		<h1 data-dojo-type="dojox.mobile.Heading">Animations</h1>
		<h2 data-dojo-type="dojox.mobile.RoundRectCategory">Transition Effects</h2>
		<ul data-dojo-type="dojox.mobile.RoundRectList">
			<li data-dojo-type="dojox.mobile.ListItem" data-dojo-props='icon:"images/i-icon-1.png", moveTo:"view2", transition:"slide"'>
				Slide
			</li>
			<li data-dojo-type="dojox.mobile.ListItem" data-dojo-props='icon:"images/i-icon-2.png", moveTo:"view2", transition:"flip"'>
				Flip
			</li>
			<li data-dojo-type="dojox.mobile.ListItem" data-dojo-props='icon:"images/i-icon-3.png", moveTo:"view2", transition:"fade"'>
				Fade
			</li>
		</ul>
	</div>

	<div id="view2" data-dojo-type="dojox.mobile.View">
		<h1 data-dojo-type="dojox.mobile.Heading" data-dojo-props='back:"Home", moveTo:"view1"'>Search Result</h1>
		<div data-dojo-type="dojox.mobile.RoundRect" data-dojo-props='shadow:true'>
			Open the browser console to see transition event logs.
		</div>
	</div>
</body>
</html>
